<template>
    <a href="/">信息添加</a>
    <h2>登录</h2>
    <table class="table">
        <thead>
            <tr>
                <th>用户名</th>
                <th>
                    <input type="text" v-model="data.names">
                </th>
            </tr>
            <tr>
                <th>密码</th>
                <th>
                    <input type="password" v-model="data.pass">
                </th>
            </tr>
            <tr>
                <th></th>
                <th>
                    <input type="button" value="登录" @click="logi">
                </th>
            </tr>
        </thead>
    </table>
</template>

<script setup lang="ts">
import axios from 'axios';
import { ref } from 'vue';
const data=ref({
  "uid": 0,
  names: "",
  pass: ""
})
const logi=()=>{
    axios.get("https://localhost:7099/api/VS/Login",{params:data.value}).then(res=>{
        if(res.data.uid==-1)
    {
        alert('用户名不存在')
        return;
    }
    else
    if(res.data.uid==-2)
    {
        alert('密码错误')
        return;
    }
    else
    {
        alert('登录成功')
    }
    })
}
</script>

<style scoped>

</style>